/* 
分类接口请求函数
*/
import request from '@/utils/request'
import type { CategoryListModel } from './model/categoryModel'

enum Api {
  // GET /admin/product/getCategory1
  GetCategory1List = '/admin/product/getCategory1',
  // GET /admin/product/getCategory2/{category1Id}
  GetCategory2List = '/admin/product/getCategory2',
  // GET /admin/product/getCategory3/{category2Id}
  GetCategory3List = '/admin/product/getCategory3',
}

// 获取一级分类列表
export const getCategory1ListApi = () => {
  return request.get<any, CategoryListModel>(Api.GetCategory1List)
}
// 获取二级分类列表
export const getCategory2ListApi = (category1Id: number) => {
  return request.get<any, CategoryListModel>(Api.GetCategory2List + `/${category1Id}`)
}
// 获取三级分类列表
export const getCategory3ListApi = (category2Id: number) => {
  return request.get<any, CategoryListModel>(Api.GetCategory3List+ `/${category2Id}`)
}